

package com.hazelcast.partition;

import com.hazelcast.cluster.Address;

/**
 * The event is fired when a primary replica of the partition is lost.
 * If a backup node crashes when owner of the partition is still alive,
 * a partition lost event won't be fired.
 *
 * @see Partition
 * @see PartitionService
 * @see PartitionLostListener
 */
public interface PartitionLostEvent extends PartitionEvent {

    /**
     * @return 0 if primary replica is lost,
     * otherwise returns count of lost backup replicas
     */
    int getLostBackupCount();

    /**
     * Returns true if all replicas of a partition are lost
     */
    boolean allReplicasInPartitionLost();

    /**
     * Returns the address of the node that dispatches the event
     *
     * @return the address of the node that dispatches the event
     */
    Address getEventSource();
}
